﻿using System;
using Autofac;
using FlickrApi;

namespace TestClient
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var container = BuildUpEnvironment();
            //dynamic jsonResponse =
            //    Utility.Utility.GetJson(
            //        " https://api.flickr.com/services/rest/?method=flickr.people.findByEmail&api_key=f668f0cb35ee2c6e7ed8421c1c6afa67&find_email=payojb%40yahoo.com&format=json&nojsoncallback=1",
            //        HttpMethod.Get,
            //        null);
            var flickrApiCaller = container.Resolve<NativeFlickrApiCaller>();
            foreach (var photoSet in flickrApiCaller.GetListOfPhotoSets())
            {
                Console.WriteLine(photoSet.CoverUrl);
                var photos = flickrApiCaller.GetListOfPhotosInPhotoSet(photoSet.Id);
                foreach (var photo in photos)
                {
                    //Console.WriteLine(photo.Url);
                }
            }

            Console.ReadKey();
        }
        private static IContainer BuildUpEnvironment()
        {
            // Create the container builder.
            var builder = new ContainerBuilder();

            // Register other dependencies.
            //builder.RegisterModule(new FlickrApiImplementation());
            builder.RegisterModule(new FlickrApiImplementation());

            // Build the container.
            var container = builder.Build();

            return container;
        }
    }
}
